package com.liyunc.demo.utils;
/**
 * Copyright (c) 2018-2022 ThunderSoft
 * All Rights Reserved by Thunder Software Technology Co., Ltd and its affiliates.
 * You may not use, copy, distribute, modify, transmit in any form this file
 * except in compliance with ThunderSoft in writing by applicable law.
 */

import com.liyunc.demo.model.dto.FileInfoDto;
import com.liyunc.demo.model.dto.ProjectInfoDto;
import com.liyunc.demo.model.dto.RoleInfoDto;
import com.liyunc.demo.model.dto.UserInfoDto;
import com.liyunc.demo.model.entity.FileInfo;
import com.liyunc.demo.model.entity.ProjectInfo;
import com.liyunc.demo.model.entity.RoleInfo;
import com.liyunc.demo.model.entity.UserInfo;

/**
 * @author liyuncong
 * @version 1.0
 * @file
 * @brief
 * @details
 * @date 2022-02-17
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2022-02-17               liyuncong        Created
 */
public class ToDtoUtils {

    /**
     * to dto.
     */
    public static ProjectInfoDto forInfoEntity(ProjectInfo info) {
        return new ProjectInfoDto(
            info.getId(),
            info.getProjectName(),
            info.getProjectDescribe(),
            info.getCreateTime(),
            info.getLastTime());
    }

    /**
     * to dto.
     */
    public static FileInfoDto forInfoEntity(FileInfo info) {
        return new FileInfoDto(
            info.getId(),
            info.getProjectId(),
            info.getFileName(),
            info.getFilePath(),
            info.getCreateUser(),
            info.getCreateTime(),
            info.getLastUser(),
            info.getLastTime());
    }

    /**
     * to dto.
     */
    public static RoleInfoDto forInfoEntity(RoleInfo info) {
        return new RoleInfoDto(
            info.getId(),
            info.getName(),
            info.getKey());
    }

    /**
     * to dto.
     */
    public static UserInfoDto forInfoEntity(UserInfo info) {
        return new UserInfoDto(
            info.getId(),
            info.getUsername());
    }

}
